package com.liull.netty.protobuf;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * @Author: liull
 * @Description:
 * @Date: Created in 21:07 2020/9/27
 * @Modified By:
 */
public class ProtoServerHandler extends SimpleChannelInboundHandler<DataInfo.Student> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, DataInfo.Student msg) throws Exception {
        System.out.println("接收到客户端消息" + msg);
        System.out.println(msg.getAddress());
        System.out.println(msg.getAge());
        System.out.println(msg.getName());
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
        cause.printStackTrace();
        ctx.close();
    }
}
